home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Sample Code / Snippets / Toolbox / ProgressBars 1.0 / Header / BareBones.h next >
Encoding:
C/C++ Source or Header  |  1996-09-17  |  2.7 KB  |  223 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        BareBones.h
  3.  
  4.     Contains:    Common header file included by all source files
  5.  
  6.     Written by:    Chris White, Developer Technical Support
  7.     
  8.     Copyright:    © 1996 by Apple Computer, Inc., all rights reserved.
  9.     
  10.     Change History (most recent first):
  11.     
  12.             1/22/96            CW        First release
  13.  
  14. */
  15.  
  16.  
  17.  
  18. #ifndef __BAREBONES__
  19. #define __BAREBONES__
  20.  
  21.  
  22.  
  23. #ifndef __DIALOGS__
  24.     #include <Dialogs.h>
  25. #endif
  26.  
  27. #ifndef __THREADS__
  28.     #include <Threads.h>
  29. #endif
  30.  
  31.  
  32.  
  33.  
  34. #define DEBUGGING    1        // Anything that shouldn't normally occur
  35. #define WARNINGS    0        // Something that can occur, but you might like to know about
  36.  
  37.  
  38.  
  39.  
  40. enum
  41. {
  42.     // Generall application stuff
  43.     
  44.     kCreatorCode = 'prgr',                    // Progress Bars
  45.     kSleepTime = 60L
  46.  
  47. };
  48.  
  49.  
  50.  
  51. enum
  52. {
  53.     // Menu ID numbers
  54.     
  55.     kMenuBarID = 1000,
  56.     kAppleMenu = 1000,
  57.     kFileMenu = 1001,
  58.     kProgressBarsMenu
  59. };
  60.  
  61.  
  62.  
  63. enum
  64. {
  65.     // Apple menu commands
  66.     
  67.     cAbout = 1
  68. };
  69.  
  70.  
  71.  
  72. enum
  73. {
  74.     // File menu commands
  75.     
  76.     cQuit = 1
  77. };
  78.  
  79.  
  80.  
  81. enum
  82. {
  83.     // ProgressBars menu commands
  84.     
  85.     cToggleThreads = 1,
  86.     cSeperator1,
  87.     cStandard,
  88.     cBarberPole
  89. };
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96. enum
  97. {
  98.     // General Windows and Dialogs
  99.  
  100.     kDisplayWindow = 1000,
  101.     kAboutDialog,
  102.      kErrorDialog
  103. };
  104.  
  105.  
  106.  
  107. enum
  108. {
  109.     // Progress Dialog
  110.     
  111.     kProgressDialogID    = 1000,
  112.         kCancelItemID    = 1,
  113.         kUserItemID,
  114.         kStaticTextItemID
  115. };
  116.  
  117.  
  118.  
  119. enum
  120. {
  121.     // Strings
  122.  
  123.     kErrorStrings = 1000,
  124.     kMiscStrings
  125. };
  126.  
  127.  
  128.  
  129. enum
  130. {
  131.     // Error String Index
  132.     
  133.     kNeedSystem7 = 1,
  134.     kGenericErrorStr
  135. };
  136.  
  137.  
  138.  
  139. enum
  140. {
  141.     // Misc String Index
  142.     
  143.     kProgressStr = 1
  144.     
  145. };
  146.  
  147.  
  148.  
  149. enum
  150. {
  151.     // Internal flags
  152.  
  153.     kBarberPoleFinished = -1
  154. };
  155.  
  156.  
  157.  
  158. enum
  159. {
  160.     // Thread readability
  161.     
  162.     kDefaultStackSpace = 0,
  163.     kNoCreationOptions = 0
  164. };
  165.  
  166.  
  167.  
  168. // Non-Threaded typedefs
  169.  
  170. // Routine pointer to the operation being carried out. It
  171. // must call the UpdateOperation routine periodically.
  172. typedef Boolean (*tOperation) ( void* refCon, DialogRef theDialog );
  173.  
  174.  
  175.  
  176.  
  177. // Threaded typedefs
  178.  
  179. struct ThreadedOperationRec
  180. {
  181.     int            usageCount;
  182.     void*        refCon;
  183.     Boolean        bCancelled;
  184.     Boolean        bBarberPole;
  185.     int            maxAmount;
  186.     int            doneAmount;
  187.     int            drawnAmount;
  188.     Str255        theText;
  189. };
  190.  
  191. typedef struct ThreadedOperationRec tThreadedOperationRec, *tThreadedOperationPtr;
  192.  
  193.  
  194. // Routine pointer to the operation being carried out. It doesn't have to do
  195. // anything special except yield to other threads.
  196. typedef pascal SInt32 (*tThreadedOperation) ( tThreadedOperationPtr refCon );
  197.  
  198.  
  199.  
  200. // Global Variable Definitions. This allows me to include this file
  201. // in all sources with the extern keyword used in all instances except
  202. // the main source file.
  203.  
  204. #ifdef __MAIN__
  205.     #define    global
  206. #else
  207.     #define    global    extern
  208. #endif
  209.  
  210.  
  211.  
  212. global    Boolean                        gQuit;                  // quit program flag
  213. global    SInt32                        gSleepTime;
  214. global    Boolean                        gHasThreadManager;        // Do we have the Thread Manager?
  215.  
  216. global     UserItemUPP                    gOutlineUserItemUPP;
  217.  
  218.     
  219.  
  220.  
  221.  
  222. #endif    // __BAREBONES__
  223.